package com.gr.experimental.reasoner.impl;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.gr.experimental.model.MTheory;
import com.gr.experimental.reasoner.MEBNReasoner;
import com.gr.experimental.reasoner.MEBNReasonerEvent;
import com.gr.experimental.reasoner.MEBNReasonerSession;


/**
 * Just a dirty sketch to help creating a real reasoner.
 * @author Karol Banczyk
 *
 */
public class SimpleReasoner implements MEBNReasoner {

	private List<MEBNReasonerSession> sessions = Collections.synchronizedList(new ArrayList<MEBNReasonerSession>());
	private MTheory mtheory;
	
	/**
	 * @param mtheory
	 */
	public SimpleReasoner(MTheory mtheory) {
		this.mtheory = mtheory;
	}

	/**
	 * {@inheritDoc}
	 * @see com.gr.experimental.reasoner.MEBNReasoner#acquireSession()
	 */
	@Override
	public MEBNReasonerSession acquireSession() {
		MEBNReasonerSession session = new SimpleSession(this);
		sessions.add(session);
		return session;
	}

	/**
	 * {@inheritDoc}
	 * @see com.gr.experimental.reasoner.MEBNReasoner#getIssuedEventClasses()
	 */
	@Override
	public List<Class<MEBNReasonerEvent>> getIssuedEventClasses() {
		return Collections.emptyList();
	}

	void removeSession(SimpleSession session) {
		sessions.remove(session);
	}
}
